if orders then


function orders:SaveTransaction(transaction)
	if self.do_save then
		if self:IsNewLimit(transaction) then
			--message("SaveTransaction")
			--transaction.ex__.assets = lib:GetAssets()
			local file = lib.path.orders .. "limit."
			for i = 0, 19 do
				if not lib:exists(file .. i) then
					lib:SaveFile(file .. i, lib:tostring(transaction))
					break
				end
			end
		end
	end
end


function orders:SavePrice(sec_code, name, price)
	if self.do_save and type(sec_code) == "string" and type(name) == "string" and price and price > 0 then
		local file = lib.path.orders .. name .."."
		for i = 0, 9 do
			if not lib:exists(file .. i) then
				local data = {
					id = i .. "_" .. math.random(100000, 999999),
					seconds = lib:tickseconds(),
					sec_code = sec_code,
					price = tostring(price)
				}
				lib:SaveLabels(file .. i, data)
				break
			end
		end
	end
end


function orders:SaveStop(sec_code, price)
	self:SavePrice(sec_code, "stop", price)
end


function orders:SaveTake(sec_code, price)
	self:SavePrice(sec_code, "take", price)
end


end -- of file
